package com.ifast.sys.util;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.ifast.sys.domain.UnitBasicinfoDO;
import com.ifast.sys.service.UnitBasicinfoService;


/**
 * 学校帮助类
 * 
 * @author chen
 * 
 */
public class UnitUtil {


	/**
	 * 获取学校列表
	 * @return
	 */
	public static Map getSchMap(UnitBasicinfoService mgr, Map params, boolean flag){
		Map map = new LinkedHashMap();
		if(flag) map.put("", "请选择");
		params.put("flag", "1");
		List<UnitBasicinfoDO> list = mgr.selectSchJustIdBsmAndName(params);
		for (UnitBasicinfoDO o : list) {
			map.put(o.getId(), o.getXxmc());
		}
		return map;
	}

	/**
	 * 获取学校单位列表
	 * @param mgr UnitServiceImpl
	 * @return List
	 */
	public static List getSchoolList(UnitBasicinfoService mgr){
		Wrapper<UnitBasicinfoDO> wrapper = new EntityWrapper();
		wrapper.where("flag='1'");
		wrapper.orderBy("xxmc");
		List<UnitBasicinfoDO> schoolbasicinfolist = mgr.selectList(wrapper);
		return schoolbasicinfolist;
	}

}
